package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.bo.WxCommentCountBo;
import com.cskaoyan.bean.bo.WxCommentListBo;
import com.cskaoyan.bean.bo.WxCommentPostBo;
import com.cskaoyan.bean.vo.*;
import com.cskaoyan.service.WxCommentListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:商品的评论
 * @Author: chaohe@com.cskaoyan
 * @Date: 2021/7/12
 * @Time: 19:18
 */
@RestController
@RequestMapping("wx/comment")
public class WxCommentListController {

    @Autowired
    WxCommentListService wxCommentListService;
    /**
     * @Author chaohe
     * @description: 商品的回显
     * @Date 8:57 2021/7/13
     * url:  http://localhost:8083/wx/comment/list
     */

    @RequestMapping("list")
    public BaseRespVo list(WxCommentListBo wxCommentListBo) {

        WxCommentListVOO wxCommentListVOO = wxCommentListService.list(wxCommentListBo);

        return BaseRespVo.ok(wxCommentListVOO);
    }
    /**
     * @Author chaohe
     * @description: 评论的总数
     * @Date 9:00 2021/7/13
     * url:    http://localhost:8083/wx/comment/count
     */

    @RequestMapping("count")
    public BaseRespVo count(WxCommentCountBo wxCommentCountBo) {
        WxCommentCountVo wxCommentCountVo = wxCommentListService.count(wxCommentCountBo);

        return BaseRespVo.ok(wxCommentCountVo);
    }

    @RequestMapping("post")
    public BaseRespVo post(@RequestBody WxCommentPostBo wxCommentPostBo) {
        WxCommentPostVo wxCommentPostVo = wxCommentListService.post(wxCommentPostBo);

        return BaseRespVo.ok(wxCommentPostVo);
    }
}
